<template>
	<view class="vislist">
		<u-table>
			<u-tr>
				<u-th>访客名</u-th>
				<u-th>访客卡号</u-th>
				<u-th>到访时间</u-th>
				<u-th>编辑</u-th>
			</u-tr>
			<u-tr v-for="(item,index) in list" :key='index'>
				<u-td>{{item.VisitorName}}</u-td>
				<u-td>{{item.CardNo}}</u-td>
				<u-td>{{item.CreateTime}}</u-td>
				<u-td>
					<u-button size="mini" :disabled="item.LeaveTime?true:false" @click="removeVis(item.VisitorID)">移除</u-button>
				</u-td>
			</u-tr>
		</u-table>
	</view>
</template>

<script>
	import http from '../../common/vmeitime-http/index.js';
	export default {
		
		data() {
			return {
				list:[],
			}
		},
		created() {
			this.getData()
		},
		methods: {
			getData(){
				// Address: "12312"
				// CardNo: 10848816
				// CreateTime: "2020-06-22 18:20:04"
				// Interviewee: "huang"
				// LeaveTime: null
				// PImage: null
				// Phone: "13929757412"
				// Reason: "公事"
				// Remark: ""
				// VisitorCardNo: ""
				// VisitorID: 16
				// VisitorName: "1233"
				http.GetVisitorList().then(res=>{
					console.log(res.data);
					this.list = res.data.list?res.data.list:[]
				})
			},
			removeVis(id){
				let parma = {VisitorID: id};
				http.Complete(parma).then(res=>{
					console.log(res);
					this.getData()
				})
			}
		}
	}
</script>

<style>
	.vislist{
		width: 100%;
		height: 100%;
		overflow-y: auto;
	}
</style>
